package com.aispace.taichu.exception;

import com.aispace.taichu.response.ResponseStatus;
import lombok.extern.slf4j.Slf4j;

/**
 * 业务异常处理
 * @author chengjie.guo
 */
@Slf4j
public class AgentException {

    public AgentException(){}

    /**
     * 返回统一异常
     * @param status
     */
    public static void fatal(ResponseStatus status) {
        log.error("return common error by {}",status.getValue());
        throw new RestStatusException(status);
    }

    public static void fatal(Integer code,String message) {
        log.error("return common error by {}",message);
        throw new RestStatusException(code,message);
    }

    public static void fatal(String message) {
        log.error("return common error by {}",message);
        throw new RestStatusException(500,message);
    }
}
